package com.bruce.practice.thread;

import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;

/**
 * @author luotuan
 * @Description
 * @create 2020-05-18 22:49
 **/
public class Test {
    public static void main(String[] args) {
        try {
            Thread thread = new Thread(){
                @SneakyThrows
                @Override
                public void run() {
                    System.out.println("开始执行");
                }
            };
            thread.start();
            System.out.println(thread.getName() + " " + thread.getState());
            //thread.sleep(1000L);
            System.out.println(thread.getName() + " " + thread.getState());
            thread.interrupt();
            System.out.println(thread.getName() + " " + thread.getState());
            System.out.println(thread.isInterrupted());
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
